#' <Add Title>
#'
#' <Add Description>
#'
#' @import htmlwidgets
#'
#' @export
volcano <- function(data,
                    titleName,
                    width = NULL, height = NULL, elementId = NULL) {

  # forward options using x
  x = list(
    data = data,
    titleName = titleName
  )

  # create widget
  htmlwidgets::createWidget(
    name = 'volcano',
    x,
    width = width,
    height = height,
    package = 'D3Widget',
    elementId = elementId
  )
}

#' Shiny bindings for volcano
#'
#' Output and render functions for using volcano within Shiny
#' applications and interactive Rmd documents.
#'
#' @param outputId output variable to read from
#' @param width,height Must be a valid CSS unit (like \code{'100\%'},
#'   \code{'400px'}, \code{'auto'}) or a number, which will be coerced to a
#'   string and have \code{'px'} appended.
#' @param expr An expression that generates a volcano
#' @param env The environment in which to evaluate \code{expr}.
#' @param quoted Is \code{expr} a quoted expression (with \code{quote()})? This
#'   is useful if you want to save an expression in a variable.
#'
#' @name volcano-shiny
#'
#' @export
volcanoOutput <- function(outputId, width = '100%', height = '400px'){
  htmlwidgets::shinyWidgetOutput(outputId, 'volcano', width, height, package = 'D3Widget')
}

#' @rdname volcano-shiny
#' @export
renderVolcano <- function(expr, env = parent.frame(), quoted = FALSE) {
  if (!quoted) { expr <- substitute(expr) } # force quoted
  htmlwidgets::shinyRenderWidget(expr, volcanoOutput, env, quoted = TRUE)
}



volcanoTest = function(){

  load_all()
  data = read.delim("https://www.bioladder.cn/shiny/zyp/bioladder2/demoData/Volcano/Volcano.txt",# 这里读取了网络上的demo数据，将此处换成你自己电脑里的文件
                    header = T    # 指定第一行是列名
  )
  data
  volcano(data=data,
              titleName = "aaa")







}
